<template>
    <div>
        <Nav>
            <div slot="left" @click="goBack"> &lt; </div>
            <div slot="center">我的-个人资料</div>
            <div slot="right" >···</div>
        </Nav>
        <click-list class="edit_item">
            <click-item :isShow="false" class="item">
                 <img src="@/assets/images/base-images/-xingming.png" alt="" slot="icon">
                <span slot="text">真实姓名</span>
                <input  type="text" placeholder="请输入真实姓名" slot="ipt" v-model="myMessage.relname">
            </click-item>
            <click-item :isShow="false" class="my-sex">
                 <img src="@/assets/images/base-images/xingbie.png" alt="" slot="icon">
                <span slot="text">性别</span>
                <div slot="ipt" class="opt" ref="sexopt">
                    <label for="man">男</label>
                    <input  type="radio" value="0" name="sex" id="man"  required="required" v-model="myMessage.sex">
                    <label for="woman">女</label>
                    <input  type="radio" value="1" name="sex" id="woman" required="required" v-model="myMessage.sex">
                </div>
            </click-item>
            <click-item :isShow="false" class="item">
                 <img src="@/assets/images/base-images/shouji.png" alt="" slot="icon">
                <span slot="text">联系方式</span>
                <input  type="text"  placeholder="请输入电话号码" slot="ipt" maxlength="11" v-model="myMessage.phone">
            </click-item>
            <click-item :isShow="false" class="item">
                 <img src="@/assets/images/base-images/zhiye.png" alt="" slot="icon">
                <span slot="text">职业</span>
                <input  type="text" placeholder="请输入职业" slot="ipt"  v-model="myMessage.duty">
            </click-item>
            <click-item :isShow="false" class="item">
                 <img src="@/assets/images/base-images/danwei.png" alt="" slot="icon">
                <span slot="text">单位</span>
                <input  type="text" placeholder="请输入单位" slot="ipt"  v-model="myMessage.units">
        </click-item>
            {{myMessage}}
            <div class="save" >
                <div class="btn"  @click="handleSave">保存</div>
            </div>
        </click-list>
    </div>
</template>

<script>
import Nav from '@/components/common/Nav.vue';
import ClickList from '@/components/clickitem/ClickList';
import ClickItem from '@/components/clickitem/ClickItem';
import {noopenidrequest,request} from '@/network/request.js';
    export default {
        data() {
            return {
                myMessage: {},
                test:{}
            }
        },
        components: {
            Nav,
            ClickList,
            ClickItem
        },
        methods: {
            goBack() {
                this.$router.go(-1)
            },
            async handleSave(){
                try {
                    const res1  = await noopenidrequest({
                        url:'api/user/edit',
                        data:this.myMessage
                    });
                    const res2 = await request({
                        url:'api/user/index',
                    });
                    alert(res1.data.msg)
                    // alert(res1.data.msg);
                    console.log(res2);
                } catch (error) {
                    console.log(error);
                }
            }
        },
    }
</script>

<style  scoped>
.edit_item{
    margin-top: 80px;
}
.item input{
    position: absolute;
    outline: none;
    border: none;
    text-align: right;
    right: 30px;
    top: 15px;
}
.my-sex .opt{
 position: absolute;
 right: 30px;
}
.btn{
    font-size: 16px;
    height: 50px;
    width: 325px;
    margin: 130px auto auto auto;
    color: #fff;
    text-align: center;
    line-height: 50px;
    border-radius: 25px;
    background: linear-gradient(to right, #1fcbcf 0%,#0484c3 100%);
}
</style>